package org.refresh.core.intelligence;

import java.util.ArrayList;
import java.util.List;

/*******************************************************************************
 * Copyright (c) 2005 Jules White. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Common Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: Jules White - initial API and implementation
 ******************************************************************************/
public class ExecutableQuery {

	private QueryEvaluator queryEvaluator_;
	private List<Constraint> constraints_;
	
	public ExecutableQuery(){}
	
	public ExecutableQuery(QueryEvaluator queryEvaluator, Constraint con) {
		super();
		queryEvaluator_ = queryEvaluator;
		constraints_ = new ArrayList<Constraint>();
		constraints_.add(con);
	}
	
	
	
	public ExecutableQuery(QueryEvaluator queryEvaluator, List<Constraint> constraints) {
		super();
		queryEvaluator_ = queryEvaluator;
		constraints_ = constraints;
	}



	public List run(Object src, List world){
		return queryEvaluator_.findAll(src, world, constraints_);
	}



	/**
	 * @return the constraints
	 */
	public List<Constraint> getConstraints() {
		return constraints_;
	}



	/**
	 * @param constraints the constraints to set
	 */
	public void setConstraints(List<Constraint> constraints) {
		constraints_ = constraints;
	}
	
	
}
